package com.example.demo.Service.Impl;

import com.example.demo.Dao.AdminApplicationDao;
import com.example.demo.Dao.UnlockApplicationDao;
import com.example.demo.Entity.AdminApplication;
import com.example.demo.Entity.UnlockApplication;
import com.example.demo.Service.UserApplicationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserApplicationServiceImpl implements UserApplicationService {
    @Autowired
    private AdminApplicationDao adminApplicationDao;
    @Autowired
    private UnlockApplicationDao unlockApplicationDao;

    @Override
    public List<AdminApplication> selectAllAdminApplication() {
        return adminApplicationDao.selectAll();
    }

    @Override
    public AdminApplication selectAdminApplicationByUserID(String uid) {
        return adminApplicationDao.selectApplicationByUserID(uid);
    }

    @Override
    public void addNewAdminApplication(AdminApplication adminApplication) {
        adminApplicationDao.addNewApplication(adminApplication);
    }

    @Override
    public void deleteByUserID(String uid) {
        adminApplicationDao.deleteByUserID(uid);
    }

    @Override
    public List<UnlockApplication> selectAllUnlockApplication() {
        return unlockApplicationDao.selectAllApplication();
    }

    @Override
    public void addNewUnlockApplication(UnlockApplication unlockApplication) {
        unlockApplicationDao.addNewApplication(unlockApplication);
    }

    @Override
    public void changeUnlockUsedByUserID(String uid, boolean used) {
        unlockApplicationDao.changeUsedByUserID(uid, used);
    }

    @Override
    public UnlockApplication selectUnlockApplicationByUserID(String uid) {
        return unlockApplicationDao.selectApplicationByUserID(uid);
    }
}
